package com.Drools.CIPS.controller;

import com.Drools.CIPS.bean.DroolsReturn;
import com.Drools.CIPS.bean.Rulers;
import com.Drools.CIPS.ruler.XlsxRuler;
import com.Drools.CIPS.util.XmlToMap;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

@RequestMapping("/drools")
@RestController
public class XlsxController {
    @Resource
    XlsxRuler xlsxRuler;

    @RequestMapping("/xlsx")//放入  xml文件和xlsx文件进行规则校验
    public DroolsReturn AllDrools(@RequestBody Map<String,Object> map){

        System.out.println("--------------");
        return xlsxRuler.XlsxRuler(
                map.get("pathXlsx").toString(),//xlsx物理位置
                XmlToMap.parseXml(map.get("pathXml").toString()/*xml物理位置*/)//xml to Map
        );
    }
}
